'use strict';

const Controller = require('egg').Controller;

class LiveuserController extends Controller {
  async list() {
    this.ctx.validate({
      liveid: {
        type: "int",
        required: true,
        defValue: "",
        desc: "liveid",
      },
    })
    const res = await this.app.model.LiveUser.findAll({
      where: {
        live_id: this.ctx.request.body.liveid
      },
      include:[{
        model:this.app.model.User,
  
        attributes:["id","username","avatar","name"]
      },
      {
        model:this.app.model.Live,
  
        attributes:["id","title","cover"]
      }]
    })
   
    this.ctx.apiSuccess(res,"获取成功",200)
  }
}

module.exports = LiveuserController;
